#ifndef SHADERMANAGER_H
#define SHADERMANAGER_H

#include"D3DUtility.h"


class Shader{
public:
	Shader(){ name = ""; effect = NULL; }
public:
	string name;
	LPD3DXEFFECT effect;
};

class ShaderManager
{
public:
	static Shader GetShader(string name)
	{
		for(list<Shader>::iterator iter = shaderList.begin(); iter != shaderList.end(); ++iter)
		{
			if(iter->name == name)
				return *iter;
		}

		Shader shader;
		shader.name = name;
		string fullPathName(name);
		fullPathName.insert(0, "./Shaders/").append(".fx");
		D3DXCreateEffectFromFile(D3DDevice, fullPathName.c_str(), NULL, NULL, D3DXSHADER_DEBUG, NULL, &shader.effect, NULL);

		return shader;
	}

public:
	static list<Shader> shaderList;
};



#endif